<!DOCTYPE html>
<html>
<head>
    <title>js面向对象--继承</title>
    <meta charset="utf-8"/>
    <script>
        //js原型实现继承
        function Person(name,age){
            this.name = name;
            this.age = age;
        }
        Person.prototype.sayHello = function(){
            document.write("使用原型得到Name：" + this.name + "</br>");
        }

        alert(Person.prototype);
        alert(Person.__proto__);

        var per = new Person("zhangping","21");
        per.sayHello();

        alert("per.constructor:" + per.constructor + "," + per.__proto__.constructor);
        alert(per instanceof Object);
        alert(per instanceof Person);

        function Student(){}
        Student.prototype = new Person("zhangping","21");
        var stu = new Student();
        Student.prototype.gade = "3";
        Student.prototype.intr = function(){
            document.write(this.gade);
        }
        stu.sayHello();
        stu.intr();
        alert(Person.prototype.isPrototypeOf(Student));
    </script>
</head>
<body>

</body>
</html>